home *** CD-ROM | disk | FTP | other *** search
- Path: news.primenet.com!not-for-mail
- From: gbe@primenet.com (Gary Edstrom)
- Newsgroups: comp.lang.c++
- Subject: Re: protected access to grandparent class
- Date: 4 Mar 1996 10:49:01 -0700
- Organization: Sequoia Software
- Sender: root@primenet.com
- Message-ID: <313b2bb5.241312055@news.primenet.com>
- References: <Dnqstp.Jo9@uns.bris.ac.uk>
- X-Posted-By: ip079.lax.primenet.com
- X-Newsreader: Forte Agent .99d/32.182
-
- Inheritance can be only "public" or "private".
- NOT "protected"
-
- Gary
-
- nathan@pact.srf.ac.uk (Nathan Sidwell) wrote:
-
- >The following class heirarchy is giving me grief.
- >-snip
- >class A {
- >protected:
- > int member;
- > void func(A){};
- >};
- >
- >class B : protected A {
- ^^^^^^^^^ ONLY "private" or "public" are allowed here.
- >protected:
- > void func(B arg) {
- > A::func(A(arg)); // ok
- > };
- >};
- >
- >class C : protected B {
- ^^^^^^^^^ ONLY "private" or "public" are allowed here.
- >protected:
- > void func(C arg) {
- > A::func(A(arg)); // failed
- > };
- >};
-
- --
- Gary Edstrom <gbe@primenet.com> | Sequoia Software
- PO Box 9573 | Programming & Technical Services
- Glendale CA 91226-0573 | PGP Key ID: 0x1A0D44BD
- PGP Fingerprint: 72 AA 4F 73 05 53 89 C6 8A EE F4 EE D1 C0 13 8D
-